Skip to content

Conversation

@sudo-bmitch
Copy link
Contributor

This is in response to #153 (comment). I didn't say "MUST be positive" because we've seen some cases where a zero length blob has been permitted.

I'm not a JSON schema expert, but it passes the tests. Other changes to descriptor_test.go were for consistency.

Signed-off-by: Brandon Mitchell <[email protected]>
Copy link
Member

@tianon tianon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for considering the zero size edge case I forgot about (frankly I forgot that "MUST be positive" is ambiguous about whether zero is positive 😂).

@tianon
Copy link
Member

tianon commented Sep 5, 2025

(fwiw, I was quoting #153 (comment))

@sudo-bmitch
Copy link
Contributor Author

Thanks for considering the zero size edge case I forgot about (frankly I forgot that "MUST be positive" is ambiguous about whether zero is positive 😂).

As long as we don't get into negative zero scenarios. 😂

@tianon
Copy link
Member

tianon commented Sep 5, 2025

"MUST NOT be negative"!!! ✊

@cyphar
Copy link
Member

cyphar commented Sep 6, 2025

Makes sense, especially given how critical sizes are to avoiding DoS attacks.

@cyphar cyphar merged commit 6519a62 into opencontainers:main Sep 6, 2025
5 checks passed
cyphar added a commit to cyphar/umoci that referenced this pull request Sep 6, 2025
VerifiedReadCloser previously would allow for negative ExpectedSize to
disable the size checking features added in commit ad66299 ("pkg:
hardening: expand to verify descriptor length").

This was based on a somewhat overly-permissive reading of the discussion
in opencontainers/image-spec#153 which was finally clarified in
opencontainers/image-spec#1285. Unknown sizes are a classic DoS vector,
so allowing them seems like a bad idea in general.

Signed-off-by: Aleksa Sarai <[email protected]>
cyphar added a commit to cyphar/umoci that referenced this pull request Sep 6, 2025
This was implicitly allowed by VerifiedReadCloser, and while we have
closed that hole it's probably best to provide a more helpful error
message.

Ref: opencontainers/image-spec#1285
Signed-off-by: Aleksa Sarai <[email protected]>
@sudo-bmitch sudo-bmitch deleted the pr-min-size branch September 6, 2025 08:31
cyphar added a commit to cyphar/umoci that referenced this pull request Sep 6, 2025
This was implicitly allowed by VerifiedReadCloser, and while we have
closed that hole it's probably best to provide a more helpful error
message.

Not blocking this earlier was mostly due to a somewhat overly-permissive
reading of the discussion in opencontainers/image-spec#153 which was
finally clarified in opencontainers/image-spec#1285. Unknown sizes are a
classic DoS vector, so allowing them (especially for descriptors where
it makes little sense to have an unknown size) seems like a bad idea in
general.

Ref: opencontainers/image-spec#1285
Signed-off-by: Aleksa Sarai <[email protected]>
cyphar added a commit to cyphar/umoci that referenced this pull request Sep 6, 2025
VerifiedReadCloser previously would allow for negative ExpectedSize to
disable the size checking features added in commit ad66299 ("pkg:
hardening: expand to verify descriptor length").

This was added partially because a somewhat overly-permissive reading of
the discussion in opencontainers/image-spec#153 (which was finally
clarified in opencontainers/image-spec#1285), but was also necessary for
some users of VerifiedReadCloser that did not really know the proper
blob size. We have now adjusted all of those callers, so there is no
longer any reason to continue supporting this.

Unknown sizes are a classic DoS vector, so allowing them seems like a
bad idea in general. We might need to adjust this if/when umoci grows
OCI distribution-spec support, but for now it isn't needed.

Signed-off-by: Aleksa Sarai <[email protected]>
cyphar added a commit to cyphar/umoci that referenced this pull request Sep 6, 2025
This was implicitly allowed by VerifiedReadCloser, and while we have
closed that hole it's probably best to provide a more helpful error
message.

Not blocking this earlier was mostly due to a somewhat overly-permissive
reading of the discussion in opencontainers/image-spec#153 which was
finally clarified in opencontainers/image-spec#1285. Unknown sizes are a
classic DoS vector, so allowing them (especially for descriptors where
it makes little sense to have an unknown size) seems like a bad idea in
general.

Ref: opencontainers/image-spec#1285
Signed-off-by: Aleksa Sarai <[email protected]>
cyphar added a commit to cyphar/umoci that referenced this pull request Sep 6, 2025
VerifiedReadCloser previously would allow for negative ExpectedSize to
disable the size checking features added in commit ad66299 ("pkg:
hardening: expand to verify descriptor length").

This was added partially because a somewhat overly-permissive reading of
the discussion in opencontainers/image-spec#153 (which was finally
clarified in opencontainers/image-spec#1285), but was also necessary for
some users of VerifiedReadCloser that did not really know the proper
blob size. We have now adjusted all of those callers, so there is no
longer any reason to continue supporting this.

Unknown sizes are a classic DoS vector, so allowing them seems like a
bad idea in general. We might need to adjust this if/when umoci grows
OCI distribution-spec support, but for now it isn't needed.

Signed-off-by: Aleksa Sarai <[email protected]>
cyphar added a commit to cyphar/umoci that referenced this pull request Sep 6, 2025
This was implicitly allowed by VerifiedReadCloser, and while we have
closed that hole it's probably best to provide a more helpful error
message.

Not blocking this earlier was mostly due to a somewhat overly-permissive
reading of the discussion in opencontainers/image-spec#153 which was
finally clarified in opencontainers/image-spec#1285. Unknown sizes are a
classic DoS vector, so allowing them (especially for descriptors where
it makes little sense to have an unknown size) seems like a bad idea in
general.

Ref: opencontainers/image-spec#1285
Signed-off-by: Aleksa Sarai <[email protected]>
cyphar added a commit to cyphar/umoci that referenced this pull request Sep 6, 2025
VerifiedReadCloser previously would allow for negative ExpectedSize to
disable the size checking features added in commit ad66299 ("pkg:
hardening: expand to verify descriptor length").

This was added partially because a somewhat overly-permissive reading of
the discussion in opencontainers/image-spec#153 (which was finally
clarified in opencontainers/image-spec#1285), but was also necessary for
some users of VerifiedReadCloser that did not really know the proper
blob size. We have now adjusted all of those callers, so there is no
longer any reason to continue supporting this.

Unknown sizes are a classic DoS vector, so allowing them seems like a
bad idea in general. We might need to adjust this if/when umoci grows
OCI distribution-spec support, but for now it isn't needed.

Signed-off-by: Aleksa Sarai <[email protected]>
cyphar added a commit to cyphar/umoci that referenced this pull request Sep 6, 2025
This was implicitly allowed by VerifiedReadCloser, and while we have
closed that hole it's probably best to provide a more helpful error
message.

Not blocking this earlier was mostly due to a somewhat overly-permissive
reading of the discussion in opencontainers/image-spec#153 which was
finally clarified in opencontainers/image-spec#1285. Unknown sizes are a
classic DoS vector, so allowing them (especially for descriptors where
it makes little sense to have an unknown size) seems like a bad idea in
general.

Ref: opencontainers/image-spec#1285
Signed-off-by: Aleksa Sarai <[email protected]>
cyphar added a commit to cyphar/umoci that referenced this pull request Sep 6, 2025
VerifiedReadCloser previously would allow for negative ExpectedSize to
disable the size checking features added in commit ad66299 ("pkg:
hardening: expand to verify descriptor length").

This was added partially because a somewhat overly-permissive reading of
the discussion in opencontainers/image-spec#153 (which was finally
clarified in opencontainers/image-spec#1285), but was also necessary for
some users of VerifiedReadCloser that did not really know the proper
blob size. We have now adjusted all of those callers, so there is no
longer any reason to continue supporting this.

Unknown sizes are a classic DoS vector, so allowing them seems like a
bad idea in general. We might need to adjust this if/when umoci grows
OCI distribution-spec support, but for now it isn't needed.

Signed-off-by: Aleksa Sarai <[email protected]>
cyphar added a commit to cyphar/umoci that referenced this pull request Sep 6, 2025
This was implicitly allowed by VerifiedReadCloser, and while we have
closed that hole it's probably best to provide a more helpful error
message.

Not blocking this earlier was mostly due to a somewhat overly-permissive
reading of the discussion in opencontainers/image-spec#153 which was
finally clarified in opencontainers/image-spec#1285. Unknown sizes are a
classic DoS vector, so allowing them (especially for descriptors where
it makes little sense to have an unknown size) seems like a bad idea in
general.

Ref: opencontainers/image-spec#1285
Signed-off-by: Aleksa Sarai <[email protected]>
cyphar added a commit to cyphar/umoci that referenced this pull request Sep 6, 2025
VerifiedReadCloser previously would allow for negative ExpectedSize to
disable the size checking features added in commit ad66299 ("pkg:
hardening: expand to verify descriptor length").

This was added partially because a somewhat overly-permissive reading of
the discussion in opencontainers/image-spec#153 (which was finally
clarified in opencontainers/image-spec#1285), but was also necessary for
some users of VerifiedReadCloser that did not really know the proper
blob size. We have now adjusted all of those callers, so there is no
longer any reason to continue supporting this.

Unknown sizes are a classic DoS vector, so allowing them seems like a
bad idea in general. We might need to adjust this if/when umoci grows
OCI distribution-spec support, but for now it isn't needed.

Signed-off-by: Aleksa Sarai <[email protected]>
cyphar added a commit to cyphar/umoci that referenced this pull request Sep 6, 2025
This was implicitly allowed by VerifiedReadCloser, and while we have
closed that hole it's probably best to provide a more helpful error
message.

Not blocking this earlier was mostly due to a somewhat overly-permissive
reading of the discussion in opencontainers/image-spec#153 which was
finally clarified in opencontainers/image-spec#1285. Unknown sizes are a
classic DoS vector, so allowing them (especially for descriptors where
it makes little sense to have an unknown size) seems like a bad idea in
general.

Ref: opencontainers/image-spec#1285
Signed-off-by: Aleksa Sarai <[email protected]>
cyphar added a commit to cyphar/umoci that referenced this pull request Sep 6, 2025
VerifiedReadCloser previously would allow for negative ExpectedSize to
disable the size checking features added in commit ad66299 ("pkg:
hardening: expand to verify descriptor length").

This was added partially because a somewhat overly-permissive reading of
the discussion in opencontainers/image-spec#153 (which was finally
clarified in opencontainers/image-spec#1285), but was also necessary for
some users of VerifiedReadCloser that did not really know the proper
blob size. We have now adjusted all of those callers, so there is no
longer any reason to continue supporting this.

Unknown sizes are a classic DoS vector, so allowing them seems like a
bad idea in general. We might need to adjust this if/when umoci grows
OCI distribution-spec support, but for now it isn't needed.

Signed-off-by: Aleksa Sarai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants